package com.liyj.heroadmin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @Title：跨域设置
 * @Description:
 * @Param: 无
 * @Return: 无
 * @author <a href="mail to: herocnhb@163.com" rel="nofollow">李亚军</a>
 * @CreateDate: 2019-12-23
 * @update: [01][日期2019-12-23日] [李亚军][无]
 */
@Configuration
public class CORSConfig {

    @Bean
    public WebMvcConfigurer corsConfigurer(){
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**")
                        .allowedHeaders("*")
                        .allowedMethods("*")
                        .allowedOrigins("*");
            }
        };
    }
}
